//
//  RMMEvaluationGoodsTableViewCell.m
//  Romomo
//
//  Created by puman on 2016/10/26.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMEvaluationGoodsTableViewCell.h"

@implementation RMMEvaluationGoodsTableViewCell
{
    UILabel *_countLabel;
    UIScrollView *_scrollView;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(15, kRow, kScreenWideth - 100, 60)];
        [self.contentView addSubview:_scrollView];
        
        for (int i = 0; i < 1000; i++) {
            UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(70 * i, 0, 60, 60)];
            imageV.image = [UIImage imageNamed:@"shangmen"];
            imageV.layer.masksToBounds = YES;
            imageV.tag = 1000000 + i;
            imageV.hidden = YES;
            imageV.layer.cornerRadius = 5;
            [_scrollView addSubview:imageV];
        }
        _countLabel = [[UILabel alloc] initWithFrame:CGRectMake(_scrollView.right, 0, 55, 70)];
        _countLabel.textColor = COLORFROMCODE(0xA0A5A7, 1);
        _countLabel.font = kFont(13);
        _countLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_countLabel];
        _countLabel.text = @"共2件";
        
    }
    return self;
}
- (void)setArray:(NSArray *)array{
    for (int i = 0; i < array.count; i++) {
        NSDictionary *dic = array[i];
        UIImageView *imageV = [self viewWithTag:1000000 + i];
        NSString *url = nil;
        url = [RMMFileManager retrunObjWith:dic[@"SER_IMG_URL"]];
        [imageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kBaseImageUrl,url.length == 0 ?[RMMFileManager retrunObjWith:dic[@"BOM_IMG_URL"]] : url]] placeholderImage:[UIImage imageNamed:@"加载中@3x"]];
        imageV.frame = CGRectMake(70 * i, 0, 60, 60);
        imageV.hidden = NO;
    }
    _countLabel.text = [NSString stringWithFormat:@"共%ld件",array.count];
    _scrollView.contentSize = CGSizeMake(70 * array.count, 60);
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
